package com.mad.base.system;

public class Range<T> implements IRange<T>
{

    private IComparable1D<T> loVal, hiVal ;
        
    public IComparable1D<T> getLoVal()
    {
        return loVal;
    }

    public void setLoVal( IComparable1D<T> loVal )
    {
        this.loVal = loVal;
    }

    public IComparable1D<T> getHiVal()
    {
        return hiVal;
    }

    public void setHiVal( IComparable1D<T> hiVal )
    {
        this.hiVal = hiVal;
    }

    public Range(IComparable1D<T> lo, IComparable1D<T> hi){
        this.setLoVal( lo ) ; 
        this.setHiVal( hi ) ; 
    }
    
    public boolean isInRange(T toBeChecked){
        return this.loVal.smallerThanOrEqual( toBeChecked ) && this.hiVal.greaterThanOrEqual( toBeChecked );  
    }
    
    @Override
    public String toString(){
        return "range: "+this.loVal+", "+this.hiVal; 
    }
}
